import { useRef } from "react";
export const Ref = () => {
  const inputRef = useRef(null)

  const handleSubmit = () => {
    console.log(inputRef.current.value);
    inputRef.current.focus()
  }
  return (
    <div>
      <input type={'text'} ref={inputRef}></input>
      <button onClick={handleSubmit}>提交</button>
    </div>
  )
}